package backend.project.gym_management.controller;

import backend.project.gym_management.service.EmployeeService;
import backend.project.gym_management.pojo.dto.EmployeeIntroDTO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/employees")
public class EmployeeController {

    @Autowired
    private EmployeeService employeeService;

    @GetMapping("/{eid}/intro")
    public ResponseEntity<EmployeeIntroDTO> getEmployeeIntro(@PathVariable Long eid) {
        EmployeeIntroDTO intro = employeeService.getEmployeeIntro(eid);
        if (intro == null) {
            return ResponseEntity.notFound().build();
        }
        return ResponseEntity.ok(intro);
    }
}
